home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / windows / tpwin31.zip / OLE.PAS < prev    next >
Pascal/Delphi Source File  |  1992-04-06  |  29KB  |  631 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Turbo Pascal for Windows Run-time Library       }
  5. {       Windows 3.1 API Interface Unit                  }
  6. {                                                       }
  7. {       Copyright (c) 1991 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit OLE;
  12.  
  13. interface
  14.  
  15. uses WinTypes;
  16.  
  17. { Object types }
  18.  
  19. const
  20.   ot_Link = 1;
  21.   ot_Embedded = 2;
  22.   ot_Static = 3;
  23.  
  24.  
  25. { activate verbs }
  26.  
  27.   oleverb_Primary = 0;
  28.  
  29. type
  30.   POleTargetDevice = ^TOleTargetDevice;
  31.   TOleTargetDevice = record
  32.     otdDeviceNameOffset: Word;
  33.     otdDriverNameOffset: Word;
  34.     otdPortNameOffset: Word;
  35.     otdExtDevmodeOffset: Word;
  36.     otdExtDevmodeSize: Word;
  37.     otdEnvironmentOffset: Word;
  38.     otdEnvironmentSize: Word;
  39.     otdData: array[0..0] of Byte;
  40.   end;
  41.  
  42. const
  43. { flags used in some methods }
  44.  
  45.   of_Set = $0001;
  46.   of_Get = $0002;
  47.   of_Handler = $0004;
  48.  
  49. { return codes for OLE functions }
  50.  
  51. type
  52.   TOleStatus = Word;
  53.  
  54. const
  55.   ole_OK = 0;                     {  0   Function operated correctly }
  56.  
  57.   ole_Wait_For_Release = 1;       {  1   Command has been initiated, client  }
  58.                                   {      must wait for release. keep dispatching }
  59.                                   {      messages till ole_RELESE in callback }
  60.  
  61.   ole_Busy = 2;                   {  2   Tried to execute a method while another }
  62.                                   {      method is in progress. }
  63.  
  64.   ole_Error_Protect_Only = 3;     {  3   Ole APIs are called in real mode  }
  65.   ole_Error_Memory = 4;           {  4   Could not alloc or lock memory }
  66.   ole_Error_Stream = 5;           {  5   (TOleStream) stream error }
  67.   ole_Error_Static = 6;           {  6   Non static object expected }
  68.   ole_Error_Blank = 7;            {  7   Critical data missing }
  69.   ole_Error_Draw = 8;             {  8   Error while drawing }
  70.   ole_Error_Metafile = 9;         {  9   Invalid metafile }
  71.   ole_Error_Abort = 10;           {  10  Client chose to abort metafile drawing }
  72.   ole_Error_Clipboard = 11;       {  11  Failed to get/set clipboard data }
  73.   ole_Error_Format = 12;          {  12  Requested format is not available }
  74.   ole_Error_Object = 13;          {  13  Not a valid object }
  75.   ole_Error_Option = 14;          {  14  Invalid option (link update / render) }
  76.   ole_Error_Protocol = 15;        {  15  Invalid protocol }
  77.   ole_Error_Address = 16;         {  16  One of the pointers is invalid }
  78.   ole_Error_Not_Equal = 17;       {  17  Objects are not equal }
  79.   ole_Error_Handle = 18;          {  18  Invalid handle encountered }
  80.   ole_Error_Generic = 19;         {  19  Some general error }
  81.   ole_Error_Class = 20;           {  20  Invalid class }
  82.   ole_Error_Syntax = 21;          {  21  Command syntax is invalid }
  83.   ole_Error_DataType = 22;        {  22  Data format is not supported }
  84.   ole_Error_Palette = 23;         {  23  Invalid color palette }
  85.   ole_Error_Not_Link = 24;        {  24  Not a linked object }
  86.   ole_Error_Not_Empty = 25;       {  25  Client doc contains objects. }
  87.   ole_Error_Size = 26;            {  26  Incorrect buffer size passed to the api }
  88.                                   {      that places some string in caller's }
  89.                                   {      buffer }
  90.   ole_Error_Drive = 27;           {  27  Drive letter in doc name is invalid }
  91.   ole_Error_Network = 28;         {  28  Failed to establish connection to a }
  92.                                   {      network share on which the document }
  93.                                   {      is located }
  94.   ole_Error_Name = 29;            {  29  Invalid name (doc name, object name), }
  95.                                   {      etc.. passed to the APIs }
  96.   ole_Error_Template = 30;        {  30  Server failed to load template }
  97.   ole_Error_New = 31;             {  31  Server failed to create new doc }
  98.   ole_Error_Edit = 32;            {  32  Server failed to create embedded }
  99.                                   {      instance }
  100.   ole_Error_Open = 33;            {  33  Server failed to open document,  }
  101.                                   {      possible invalid link }
  102.   ole_Error_Not_Open = 34;        {  34  Object is not open for editing }
  103.   ole_Error_Launch = 35;          {  35  Failed to launch server }
  104.   ole_Error_Comm = 36;            {  36  Failed to communicate with server }
  105.   ole_Error_Terminate = 37;       {  37  Error in termination }
  106.   ole_Error_Command = 38;         {  38  Error in execute }
  107.   ole_Error_Show = 39;            {  39  Error in show }
  108.   ole_Error_DoVerb = 40;          {  40  Error in sending do verb, or invalid }
  109.                                   {      verb }
  110.   ole_Error_Advise_Native = 41;   {  41  Item could be missing }
  111.   ole_Error_Advise_Pict = 42;     {  42  Item could be missing or server doesn't }
  112.                                   {      this format. }
  113.   ole_Error_Advise_Rename = 43;   {  43  Server doesn't support rename }
  114.   ole_Error_Poke_Native = 44;     {  44  Failure of poking native data to server }
  115.   ole_Error_Request_Native = 45;  {  45  Server failed to render native data }
  116.   ole_Error_Request_Pict = 46;    {  46  Server failed to render presentation }
  117.                                   {      data }
  118.   ole_Error_Server_Blocked = 47;  {  47  Trying to block a blocked server or }
  119.                                   {      trying to revoke a blocked server }
  120.                                   {      or document }
  121.   ole_Error_Registration = 48;    {  48  Server is not registered in regestation }
  122.                                   {      data base }
  123.   ole_Error_Already_Registered = 49;{ 49  Trying to register same doc multiple }
  124.                                   {     times }
  125.   ole_Error_Task = 50;            {  50  Server or client task is invalid }
  126.   ole_Error_OutOfDate = 51;       {  51  Object is out of date }
  127.   ole_Error_Cant_Update_Client = 52;{  52  embed doc's client doesn't accept  }
  128.                                   {      updates }
  129.   ole_Error_Update = 53;          {  53  erorr while trying to update  }
  130.  
  131.   ole_Error_Setdata_Format = 54;  { 54  Server app doesn't understand the       }
  132.                                   {     format given to its SetData method      }
  133.   ole_Error_Static_From_Other_OS = 55; { 55 trying to load a static object created }
  134.                                   {    on another Operating System           }
  135.   {  Following are warnings    }
  136.  
  137.   ole_Warn_Delete_Data = 1000;    {      Caller must delete the data when he is }
  138.                                   {      done with it. }
  139.  
  140. {  Codes for CallBack events }
  141. type
  142.   TOle_Notification = Word;
  143.  
  144. const
  145.   ole_Changed = 0;            {  0 }
  146.   ole_Saved = 1;              {  1 }
  147.   ole_Closed = 2;             {  2 }
  148.   ole_Renamed = 3;            {  3 }
  149.   ole_Query_Paint = 4;        {  4  Interruptible paint support }
  150.   ole_Release = 5;            {  5  Object is released (asynchronous operation }
  151.                               {     is completed) }
  152.   ole_Query_Retry = 6;        {  6  Query for retry when server sends busy ACK }
  153.  
  154.  
  155. type
  156.   TOle_Release_Method = Word;
  157.  
  158. const
  159.   ole_None = 0;                {  0  no method active }
  160.   ole_Delete = 1;              {  1  object delete }
  161.   ole_LnkPaste = 2;            {  2  PasteLink (auto reconnect) }
  162.   ole_EmbPaste = 3;            {  3  paste (and update)  }
  163.   ole_Show = 4;                {  4  Show }
  164.   ole_Run = 5;                 {  5  Run }
  165.   ole_Activate = 6;            {  6  Activate }
  166.   ole_Update = 7;              {  7  Update }
  167.   ole_Close = 8;               {  8  Close }
  168.   ole_Reconnect = 9;           {  9  Reconnect }
  169.   ole_SetUpdateOptions = 10;   {  10 setting update options }
  170.   ole_ServerUnlaunch = 11;     {  11 server is being unlaunched }
  171.   ole_LoadFromStream = 12;     {  12 LoadFromStream (auto reconnect) }
  172.   ole_SetData = 13;            {  13 OleSetData }
  173.   ole_RequestData = 14;        {  14 OleRequestData }
  174.   ole_Other = 15;              {  15 other misc async operations }
  175.   ole_Create = 16;             {  16 create }
  176.   ole_CreateFromTemplate = 17; {  17 CreatefromTemplate }
  177.   ole_CreateLinkFromFile = 18; {  18 CreateLinkFromFile }
  178.   ole_CopyFromLnk = 19;        {  19 CopyFromLink (auto reconnect) }
  179.   ole_CreateFromFile = 20;     {  20 CreateFromFile }
  180.   ole_CreateInvisible = 21;    {  21 CreateInvisible }
  181.  
  182.   { rendering options }
  183.  
  184. type
  185.   TOleOpt_Render = Word;
  186.  
  187. const
  188.   olerender_none = 0;
  189.   olerender_draw = 1;
  190.   olerender_format = 2;
  191.  
  192. type
  193.   TOleClipFormat = Word; {  standard clipboard format type }
  194.  
  195.   { Link update options }
  196.  
  197.   TOleOpt_Update = Word;
  198.  
  199. const
  200.   oleupdate_always = 0;
  201.   oleupdate_onsave = 1;
  202.   oleupdate_oncall = 2;
  203.   oleupdate_onclose = 3;
  204.  
  205. type
  206.   HObject = THandle;
  207.   LHServer = Longint;
  208.   LHClientDoc = Longint;
  209.   LHServerDoc = Longint;
  210.  
  211.   POleObject = ^TOleObject;
  212.   POleStream = ^TOleStream;
  213.   POleClient = ^TOleClient;
  214.   POleObjectVTbl = ^TOleObjectVTbl;
  215.  
  216.   TOleObject = record
  217.     lpvtbl: POleObjectVTbl;
  218.   end;
  219.  
  220.   TOleObjectVTbl = record
  221.     QueryProtocol: function (Self: POleObject; Protocol: PChar): Pointer;
  222.     Release: function (Self: POleObject): TOleStatus;
  223.     Show: function (Self: POleObject; TakeFocus: Bool): TOleStatus;
  224.     DoVerb: function (Self: POleObject; Verb: Word; Show, Focus: Bool): TOleStatus;
  225.     GetData: function (Self: POleObject; Format: TOleClipFormat;
  226.       var Handle: THandle): TOleStatus;
  227.     SetData: function (Self: POleObject; Format: TOleClipFormat;
  228.       Data: THandle): TOleStatus;
  229.     SetTargetDevice: function (Self: POleObject;
  230.       TargetDevice: THandle): TOleStatus;
  231.     SetBounds: function (Self: POleObject; var Bounds: TRect): TOleStatus;
  232.     EnumFormats: function (Self: POleObject;
  233.       Format: TOleClipFormat): TOleClipFormat;
  234.     SetColorScheme: function (Self: POleObject; var Palette:
  235.       TLogPalette): TOleStatus;
  236.  
  237.     { Server has to implement only the above methods. }
  238.  
  239.     { Extra methods required for client. }
  240.  
  241.     Delete: function (Self: POleObject): TOleStatus;
  242.     SetHostNames: function (Self: POleObject; Client,
  243.       ClientObj: PChar): TOleStatus;
  244.     SaveToStream: function (Self: POleObject; Stream: POleStream): TOleStatus;
  245.     Clone: function (Self: POleObject; Client: POleClient;
  246.       ClientDoc: LHClientDoc; ObjectName: PChar;
  247.       var OleObject: POleObject): TOleStatus;
  248.     CopyFromLink: function (Self: POleObject; Client: POleClient;
  249.       ClientDoc: LHClientDoc; ObjName: PChar;
  250.       var OleObject: POleObject): TOleStatus;
  251.     Equal: function (Self: POleObject; OleObject: POleObject): TOleStatus;
  252.     CopyToClipboard: function (Self: POleObject): TOleStatus;
  253.     Draw: function (Self: POleObject; DC: HDC; var Bounds, WBounds: TRect;
  254.       FormatDC: HDC): TOleStatus;
  255.     Activate: function (Self: POleObject; Verb: Word; Show, TakeFocus: Bool;
  256.       hWnd: HWnd; Bounds: PRect): TOleStatus;
  257.     Execute: function (Self: POleObject; Commands: THandle;
  258.       Reserved: Word): TOleStatus;
  259.     Close: function (Self: POleObject): TOleStatus;
  260.     Update: function (Self: POleObject): TOleStatus;
  261.     Reconnect: function (Self: POleObject): TOleStatus;
  262.  
  263.     ObjectConvert: function (Self: POleObject; Protocol: PChar;
  264.       Client: POleClient; ClientDoc: LHClientDoc; ObjName: PChar;
  265.       var OleObject: POleObject): TOleStatus;
  266.     GetLinkUpdateOptions: function (Self: POleObject;
  267.       var UpdateOpt: TOleOpt_Update): TOleStatus;
  268.     SetLinkUpdateOptions: function (Self: POleObject;
  269.       UpdateOpt: TOleOpt_Update): TOleStatus;
  270.  
  271.     Rename: function (Self: POleObject; NewName: PChar): TOleStatus;
  272.     QueryName: function (Self: POleObject; Name: PChar;
  273.       var NameSize: Word): TOleStatus;
  274.  
  275.     QueryType: function (Self: POleObject; var ObjType: Longint): TOleStatus;
  276.     QueryBounds: function (Self: POleObject; var Bounds: TRect): TOleStatus;
  277.     QuerySize: function (Self: POleObject; var Size: Longint): TOleStatus;
  278.     QueryOpen: function (Self: POleObject): TOleStatus;
  279.     QueryOutOfDate: function (Self: POleObject): TOleStatus;
  280.  
  281.     QueryReleaseStatus: function (Self: POleObject): TOleStatus;
  282.     QueryReleaseError: function (Self: POleObject): TOleStatus;
  283.     QueryReleaseMethod: function (Self: POleObject): TOle_Release_Method;
  284.  
  285.     RequestData: function (Self: POleObject;
  286.       Format: TOleClipFormat): TOleStatus;
  287.     ObjectLong: function (Self: POleObject; Flags: Word;
  288.       Data: PLongint): TOleStatus;
  289.  
  290.     { This method is internal only }
  291.     ChangeData: function (Self: POleObject; Data: THandle;
  292.      Client: POleClient; Flag: Bool): TOleStatus;
  293.   end;
  294.  
  295.   { ole client definitions }
  296.  
  297.   POleClientVTbl = ^TOleClientVTbl;
  298.  
  299.   TOleClient = record
  300.     lpvtbl: POleClientVTBL;
  301.   end;
  302.  
  303.   TOleClientVTbl = record
  304.     CallBack: function (Client: POleClient; Nofication: TOle_Notification;
  305.       OleObject: POleObject): Integer;
  306.   end;
  307.  
  308.   { Stream definitions }
  309.  
  310.   POleStreamVTbl = ^TOleStreamVTbl;
  311.  
  312.   TOleStream = record
  313.     lpstbl: POleStreamVTbl;
  314.   end;
  315.  
  316.   TOleStreamVTbl = record
  317.     Get: function (Stream: POleStream; Buffer: PChar;
  318.       Size: Longint): Longint;
  319.     Put: function (Stream: POleStream; Buffer: PChar;
  320.       Size: Longint): Longint;
  321.   end;
  322.  
  323. { Public Function Prototypes }
  324.  
  325. function OleDelete(Self: POleObject): TOleStatus;
  326. function OleRelease(Self: POleObject): TOleStatus;
  327. function OleSaveToStream(Self: POleObject; Stream: POleStream): TOleStatus;
  328. function OleEqual(Self: POleObject; OleObject: POleObject): TOleStatus;
  329. function OleCopyToClipboard(Self: POleObject): TOleStatus;
  330. function OleSetHostNames(Self: POleObject; ClientName,
  331.   ObjectName: PChar): TOleStatus;
  332. function OleSetTargetDevice(Self: POleObject;
  333.   TargetDevice: THandle): TOleStatus;
  334. function OleSetBounds(Self: POleObject; var Bounds: TRect): TOleStatus;
  335. function OleSetColorScheme(Self: POleObject;
  336.   var Palette: TLogPalette): TOleStatus;
  337. function OleQueryBounds(Self: POleObject; var Bounds: TRect): TOleStatus;
  338. function OleQuerySize(Self: POleObject; var Size: Longint): TOleStatus;
  339. function OleDraw(Self: POleObject; DC: HDC; var Bounds, WBounds: TRect;
  340.   FormatDC: HDC): TOleStatus;
  341. function OleQueryOpen(Self: POleObject): TOleStatus;
  342. function OleActivate(Self: POleObject; Verb: Word; Show, TakeFocus: Bool;
  343.   hWnd: HWnd; Bounds: PRect): TOleStatus;
  344. function OleExecute(Self: POleObject; Commands: THandle;
  345.   Reserved: Word): TOleStatus;
  346. function OleClose(Self: POleObject): TOleStatus;
  347. function OleUpdate(Self: POleObject): TOleStatus;
  348. function OleReconnect(Self: POleObject): TOleStatus;
  349.  
  350. function OleGetLinkUpdateOptions(Self: POleObject;
  351.   var UpdateOpt: TOleOpt_Update): TOleStatus;
  352. function OleSetLinkUpdateOptions(Self: POleObject;
  353.   UpdateOpt: TOleOpt_Update): TOleStatus;
  354.  
  355. function OleQueryProtocol(Self: POleObject; Protocol: PChar): Pointer;
  356.  
  357. { Routines related to asynchronous operations. }
  358.  
  359. function OleQueryReleaseStatus(Self: POleObject): TOleStatus;
  360. function OleQueryReleaseError(Self: POleObject): TOleStatus;
  361. function OleQueryReleaseMethod(Self: POleObject): TOle_Release_Method;
  362.  
  363. function OleQueryType(Self: POleObject; var LinkType: Longint): TOleStatus;
  364.  
  365. { Low word is major version, High word is minor version }
  366.  
  367. function OleQueryClientVersion: Longint;
  368. function OleQueryServerVersion: Longint;
  369.  
  370. { Converting to format (as in clipboard): }
  371.  
  372. function OleEnumFormats(Self: POleObject;
  373.   Format: TOleClipFormat): TOleClipFormat;
  374.  
  375. function OleGetData(Self: POleObject; Format: TOleClipFormat;
  376.   var Data: THandle): TOleStatus;
  377. function OleSetData(Self: POleObject; Format: TOleClipFormat;
  378.   Data: THandle): TOleStatus;
  379. function OleQueryOutOfDate(Self: POleObject): TOleStatus;
  380. function OleRequestData(Self: POleObject;
  381.   Format: TOleClipFormat): TOleStatus;
  382.  
  383. { Query apis for creation from clipboard }
  384.  
  385. function OleQueryLinkFromClip(Protocol: PChar; render_opt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
  386. function OleQueryCreateFromClip(Protocol: PChar; render_opt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
  387.  
  388. { Object creation functions }
  389.  
  390. function OleCreateFromClip(Protocol: PChar; Client: POleClient;
  391.   ClientDoc: LHClientDoc; ObjName: PChar; var OleObject: POleObject;
  392.   RenderOpt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
  393. function OleCreateLinkFromClip(Protocol: PChar; Client: POleClient;
  394.   ClientDoc: LHClientDoc; ObjectName: PChar; var OleObject: POleObject;
  395.   RenderOpt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
  396. function OleCreateFromFile(Protocol: PChar; Client: POleClient;
  397.   Class, OleFile: PChar; ClientDoc: LHClientDoc; ObjName: PChar;
  398.   var OleObject: POleObject; RenderOpt: TOleOPT_Render;
  399.   Format: TOleClipFormat): TOleStatus;
  400. function OleCreateLinkFromFile(Protocol: PChar; Client: POleClient;
  401.   Class, OleFile, Item: PChar; ClientDoc: LHClientDoc; ObjName: PChar;
  402.   var OleObject: POleObject; RenderOpt: TOleOPT_Render;
  403.   Format: TOleClipFormat): TOleStatus;
  404. function OleLoadFromStream(Stream: POleStream; Protocol: PChar;
  405.   Client: POleClient; ClientDoc: LHClientDoc; ObjectName: PChar;
  406.   var OleObject: POleObject): TOleStatus;
  407.  
  408. function OleCreate(Protocol: PChar; Client: POleClient; Class: PChar;
  409.   ClientDoc: LHClientDoc; ObjectName: PChar; var OleObject: POleObject;
  410.   RenderOpt: TOleOPT_Render; Format: TOleClipFormat): TOleStatus;
  411. function OleCreateInvisible(Protocol: PChar; Client: POleClient; Class: PChar;
  412.   ClientDoc: LHClientDoc; ObjName: PChar; var OleObject: POleObject;
  413.   RenderOpt: TOleOPT_Render; Format: TOleClipFormat;
  414.   Activate: Bool): TOleStatus;
  415. function OleCreateFromTemplate(Protocol: PChar; Client: POleClient;
  416.   Template: PChar; ClientDoc: LHClientDoc; ObjName: PChar;
  417.   var OleObject: POleObject; RenderOpt: TOleOPT_Render;
  418.   Format: TOleClipFormat): TOleStatus;
  419. function OleClone(OleObject: POleObject; Client: POleClient;
  420.   ClientDoc: LHClientDoc; ObjName: PChar; var OleObject: POleObject): TOleStatus;
  421. function OleCopyFromLink(OleObject: POleObject; Protocol: PChar;
  422.   Client: POleClient; ClientDoc: LHClientDoc; ObjName: PChar;
  423.   var OleObject: POleObject): TOleStatus;
  424.  
  425. function OleObjectConvert(OleObject: POleObject; Protocol: PChar;
  426.   Client: POleClient; ClientDoc: LHClientDoc; ObjName: PChar;
  427.   var OleObject: POleObject): TOleStatus;
  428.  
  429. function OleRename(Self: POleObject; NewName: PChar): TOleStatus;
  430. function OleQueryName(Self: POleObject; Name: PChar;
  431.   var NameSize: Word): TOleStatus;
  432.  
  433.  
  434. function OleRevokeObject(Client: POleClient): TOleStatus;
  435. function OleIsDcMeta(DC: HDC): Bool;
  436.  
  437. { client document API  }
  438.  
  439. function OleRegisterClientDoc(Class, Doc: PChar; Reserved: Longint;
  440.   var Doc: LHClientDoc): TOleStatus;
  441. function OleRevokeClientDoc(ClientDoc: LHClientDoc): TOleStatus;
  442. function OleRenameClientDoc(ClientDoc: LHClientDoc;
  443.   NewDocName: PChar): TOleStatus;
  444. function OleRevertClientDoc(ClientDoc: LHClientDoc): TOleStatus;
  445. function OleSavedClientDoc(ClientDoc: LHClientDoc): TOleStatus;
  446. function OleEnumObjects(ClientDoc: LHClientDoc;
  447.   var OleObject: POleObject): TOleStatus;
  448.  
  449. { server usage definitions }
  450.  
  451. type
  452.   TOle_Server_Use =  Word;
  453.  
  454. const
  455.   ole_Server_Multi = 0;            { multiple instances }
  456.   ole_Server_Single = 1;           { single instance (multiple document) }
  457.  
  458. { Server API }
  459.  
  460. type
  461.   POleServer = ^TOleServer;
  462.   POleServerDoc = ^TOleServerDoc;
  463.   POleServerVTBl = ^TOleServerVTbl;
  464.  
  465.   TOleServerVTbl = record
  466.     Open: function (Server: POleServer; Doc: LHServerDoc; DocName: PChar;
  467.       var ServerDoc: POleServerDoc): TOleStatus;
  468.                                     { long handle to doc (privtate to DLL) }
  469.                                     { lp to OleServer }
  470.                                     { document name }
  471.                                     { place holder for returning oledoc. }
  472.  
  473.  
  474.     Create: function (Server: POleServer; Doc: LHServerDoc; Class,
  475.       DocName: PChar; var ServerDoc: POleServerDoc): TOleStatus;
  476.                                     { long handle to doc (privtate to DLL) }
  477.                                     { lp to OleServer }
  478.                                     { lp class name }
  479.                                     { lp doc name }
  480.                                     { place holder for returning oledoc. }
  481.  
  482.  
  483.     CreateFromTemplate: function (Server: POleServer; Doc: LHServerDoc; Class,
  484.       DocName, TemplateName: PChar; var ServerDoc: POleServerDoc): TOleStatus;
  485.  
  486.                                     { long handle to doc (privtate to DLL) }
  487.                                     { lp to OleServer }
  488.                                     { lp class name }
  489.                                     { lp doc name }
  490.                                     { lp template name }
  491.                                     { place holder for returning oledoc. }
  492.  
  493.  
  494.     Edit: function (Server: POleServer; Doc: LHServerDoc; Class,
  495.       DocName: PChar; var ServerDoc: POleServerDoc): TOleStatus;
  496.  
  497.                                     { long handle to doc (privtate to DLL) }
  498.                                     { lp to OleServer }
  499.                                     { lp class name }
  500.                                     { lp doc name }
  501.                                     { place holder for returning oledoc. }
  502.  
  503.     Exit: function (Server: POleServer): TOleStatus;
  504.  
  505.                                     { lp OleServer }
  506.  
  507.  
  508.     Release: function (Server: POleServer): TOleStatus;
  509.                                     { lp OleServer }
  510.  
  511.     Execute: function (Server: POleServer; Commands: THandle): TOleStatus;
  512.                                     { lp OleServer }
  513.                                     { handle to command strings }
  514.   end;
  515.  
  516.   TOleServer = record
  517.     lpvtbl: POleServerVTbl;
  518.   end;
  519.  
  520.   POleServerDocVTbl = ^TOleServerDocVTbl;
  521.   TOleServerDocVTbl = record
  522.     Save: function (Doc: POleServerDoc): TOleStatus;
  523.     Close: function (Doc: POleServerDoc): TOleStatus;
  524.     SetHostNames: function (Doc: POleServerDoc; Client, Doc: PChar): TOleStatus;
  525.     SetDocDimensions: function (Doc: POleServerDoc;
  526.      var Bounds: TRect): TOleStatus;
  527.     GetObject: function (Doc: POleServerDoc; Item: PChar;
  528.       var OleObject: POleObject; Client: POleClient): TOleStatus;
  529.     Release: function (Doc: POleServerDoc): TOleStatus;
  530.     SetColorScheme: function (Doc: POleServerDoc;
  531.      var Palette: TLogPalette): TOleStatus;
  532.     Execute: function (Doc: POleServerDoc; Commands: THandle): TOleStatus;
  533.   end;
  534.  
  535.   TOleServerDoc = record
  536.     lpvtbl: POleServerDocVTbl;
  537.   end;
  538.  
  539.  
  540. function OleRegisterServer(Class: PChar; ServerDef: POleServer;
  541.   var Server: LHServer; Inst: THandle; Use: TOle_Server_Use): TOleStatus;
  542. function OleRevokeServer(Server: LHServer): TOleStatus;
  543. function OleBlockServer(Server: LHServer): TOleStatus;
  544. function OleUnblockServer(Server: LHServer; var Reqests: Bool): TOleStatus;
  545.  
  546. { APIs to keep server open }
  547.  
  548. function OleLockServer(OleObject: POleObject; var Server: LHServer): TOleStatus;
  549. function OleUnlockServer(Sever: LHServer): TOleStatus;
  550.  
  551. { Server document API  }
  552.  
  553. function OleRegisterServerDoc(Server: LHServer; DocName: PChar;
  554.   DocDef: POleServerDoc; var Doc: LHServerDoc): TOleStatus;
  555. function OleRevokeServerDoc(Doc: LHServerDoc): TOleStatus;
  556. function OleRenameServerDoc(Doc: LHServerDoc; NewName: PChar): TOleStatus;
  557. function OleRevertServerDoc(Doc: LHServerDoc): TOleStatus;
  558. function OleSavedServerDoc(Doc: LHServerDoc): TOleStatus;
  559.  
  560. implementation
  561.  
  562. function OleDelete;                        external 'OLECLI'   index 2;
  563. function OleRelease;                       external 'OLECLI'   index 40;
  564. function OleSaveToStream;                  external 'OLECLI'   index 3;
  565. function OleEqual;                         external 'OLECLI'   index 8;
  566. function OleCopyToClipboard;               external 'OLECLI'   index 13;
  567. function OleSetHostNames;                  external 'OLECLI'   index 15;
  568. function OleSetTargetDevice;               external 'OLECLI'   index 16;
  569. function OleSetBounds;                     external 'OLECLI'   index 17;
  570. function OleSetColorScheme;                external 'OLECLI'   index 49;
  571. function OleQueryBounds;                   external 'OLECLI'   index 18;
  572. function OleQuerySize;                     external 'OLECLI'   index 56;
  573. function OleDraw;                          external 'OLECLI'   index 19;
  574. function OleQueryOpen;                     external 'OLECLI'   index 20;
  575. function OleActivate;                      external 'OLECLI'   index 21;
  576. function OleExecute;                       external 'OLECLI'   index 57;
  577. function OleClose;                         external 'OLECLI'   index 27;
  578. function OleUpdate;                        external 'OLECLI'   index 22;
  579. function OleReconnect;                     external 'OLECLI'   index 23;
  580. function OleGetLinkUpdateOptions;          external 'OLECLI'   index 24;
  581. function OleSetLinkUpdateOptions;          external 'OLECLI'   index 25;
  582. function OleQueryProtocol;                 external 'OLECLI'   index 30;
  583. function OleQueryReleaseStatus;            external 'OLECLI'   index 35;
  584. function OleQueryReleaseError;             external 'OLECLI'   index 36;
  585. function OleQueryReleaseMethod;            external 'OLECLI'   index 37;
  586. function OleQueryType;                     external 'OLECLI'   index 14;
  587. function OleQueryClientVersion;            external 'OLECLI'   index 59;
  588. function OleQueryServerVersion;            external 'OLESVR'   index 12;
  589. function OleEnumFormats;                   external 'OLECLI'   index 26;
  590. function OleGetData;                       external 'OLECLI'   index 28;
  591. function OleSetData;                       external 'OLECLI'   index 29;
  592. function OleQueryOutOfDate;                external 'OLECLI'   index 31;
  593. function OleRequestData;                   external 'OLECLI'   index 50;
  594. function OleQueryLinkFromClip;             external 'OLECLI'   index 9;
  595. function OleQueryCreateFromClip;           external 'OLECLI'   index 10;
  596. function OleCreateFromClip;                external 'OLECLI'   index 12;
  597. function OleCreateLinkFromClip;            external 'OLECLI'   index 11;
  598. function OleCreateFromFile;                external 'OLECLI'   index 38;
  599. function OleCreateLinkFromFile;            external 'OLECLI'   index 39;
  600. function OleLoadFromStream;                external 'OLECLI'   index 4;
  601. function OleCreate;                        external 'OLECLI'   index 34;
  602. function OleCreateFromTemplate;            external 'OLECLI'   index 33;
  603. function OleClone;                         external 'OLECLI'   index 6;
  604. function OleCopyFromLink;                  external 'OLECLI'   index 7;
  605. function OleObjectConvert;                 external 'OLECLI'   index 32;
  606. function OleRename;                        external 'OLECLI'   index 46;
  607. function OleQueryName;                     external 'OLECLI'   index 48;
  608. function OleRevokeObject;                  external 'OLESVR'   index 11;
  609. function OleIsDcMeta;                      external 'OLECLI'   index 60;
  610. function OleRegisterClientDoc;             external 'OLECLI'   index 41;
  611. function OleRevokeClientDoc;               external 'OLECLI'   index 42;
  612. function OleRenameClientDoc;               external 'OLECLI'   index 43;
  613. function OleRevertClientDoc;               external 'OLECLI'   index 44;
  614. function OleSavedClientDoc;                external 'OLECLI'   index 45;
  615. function OleEnumObjects;                   external 'OLECLI'   index 47;
  616. function OleRegisterServer;                external 'OLESVR'   index 2;
  617. function OleRevokeServer;                  external 'OLESVR'   index 3;
  618. function OleBlockServer;                   external 'OLESVR'   index 4;
  619. function OleUnblockServer;                 external 'OLESVR'   index 5;
  620. function OleLockServer;                    external 'OLECLI'   index 54;
  621. function OleUnlockServer;                  external 'OLECLI'   index 55;
  622. function OleRegisterServerDoc;             external 'OLESVR'   index 6;
  623. function OleRevokeServerDoc;               external 'OLESVR'   index 7;
  624. function OleRenameServerDoc;               external 'OLESVR'   index 8;
  625. function OleRevertServerDoc;               external 'OLESVR'   index 9;
  626. function OleSavedServerDoc;                external 'OLESVR'   index 10;
  627. function OleCreateInvisible;               external 'OLECLI'   index 58;
  628.  
  629. end.
  630.  
  631.